Channels

interface Channels

This module provides methods for managing channels within Rainbow.

The Channels interface offers functionality to interact with channels created or joined by the user. It enables users to browse, create, manage, and participate in various communication channels. A channel can be associated with a category and may include posts and users who can interact with them.

This interface can be used to:

  • Retrieve joined channels: Access a list of channels the user is currently a member of.

  • Retrieve available channels: Browse public or discoverable channels available to join.

  • Create new channels: Allow users to create and configure their own channels for specific topics or groups.

  • Join or leave channels: Manage channel memberships by joining or leaving specific channels.

  • Modify channel settings: Update channel details, such as name, description, visibility, or access permissions.

  • Search for channels: Look up a specific channel by its unique identifier or name.

Samples

com.ale.rainbowsdk.samples.ChannelsSample

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Interface defining callbacks for handling events related to Channels within the SDK.

Properties

Link copied to clipboard
abstract val allChannels: ArrayItemList<Channel>

Get all channels (user's, owned, subscribed, pending, and most followed/recent). The returned ArrayItemList object allows you to listen for changes.

Link copied to clipboard
abstract val allOwnedChannels: List<Channel>

Get all channels the user owns.

Link copied to clipboard
abstract val allPendingChannels: List<Channel>

Get all channels with pending membership requests for the user.

Link copied to clipboard
abstract val allSubscribedChannels: List<Channel>

Get all channels the user has subscribed to.

Link copied to clipboard
abstract val allUserChannels: List<Channel>

Get all channels the user is owner, a member of or invited to.

Link copied to clipboard
abstract val tenMostFollowedChannels: List<Channel>

Get the ten most followed channels the user is allowed to view.

Link copied to clipboard
abstract val tenMostRecentChannels: List<Channel>

Get the ten most recent channels the user is allowed to view.

Functions

Link copied to clipboard
abstract suspend fun acceptChannelInvitation(channelId: String): RainbowResult<Unit>

Accept an invitation to join a specific channel.

Link copied to clipboard
abstract suspend fun addUsersToChannel(    channel: Channel,     type: ChannelUserAffiliationType,     contacts: ArrayList<IRainbowContact>): RainbowResult<Pair<List<ChannelUser>, List<String>>>
abstract suspend fun addUsersToChannel(    channel: Channel,     type: ChannelUserAffiliationType,     contactsId: List<String>): RainbowResult<Pair<List<ChannelUser>, List<String>>>

Add users to a channel.

Link copied to clipboard
abstract suspend fun browseChannels(    categories: List<String>? = null,     excludedCategories: List<String>? = null,     subscribed: Boolean? = null,     limit: Int = 100,     offset: Int = 0,     sortField: String = "subscribers_count",     sortOrder: Int = SORT_DESCENDING): RainbowResult<List<Channel>>

Browse and filter channels based on specified criteria.

Link copied to clipboard
abstract suspend fun createChannel(    name: String,     topic: String? = null,     mode: Channel.Mode? = null,     category: String? = null,     autoProvisioning: Boolean? = null,     maxItems: Int? = null): RainbowResult<Channel>

Create a new channel with specified parameters.

Link copied to clipboard
abstract suspend fun createClosedChannel(    name: String,     description: String?,     category: String?,     autoProvisioning: Boolean,     maxItems: Int): RainbowResult<Channel>

Create a closed channel that is not discoverable by search.

Link copied to clipboard
abstract suspend fun createItem(channel: Channel, channelItem: IChannelItem): RainbowResult<String>

Create a new item in the specified channel.

Link copied to clipboard
abstract suspend fun createPublicChannel(name: String, description: String?, category: String?, maxItems: Int): RainbowResult<Channel>

Create a public channel visible within the company.

Link copied to clipboard
abstract suspend fun declineChannelInvitation(channelId: String): RainbowResult<Unit>

Decline an invitation to join a specific channel.

Link copied to clipboard
abstract suspend fun deleteAllUsersFromChannel(channel: Channel): RainbowResult<Unit>

Remove all users from the specified channel.

Link copied to clipboard
abstract suspend fun deleteChannel(channelId: String): RainbowResult<Unit>

Delete a channel.

Link copied to clipboard
abstract suspend fun deleteChannelAvatar(channelId: String): RainbowResult<Unit>

Delete the avatar for a specific channel.

Link copied to clipboard
abstract suspend fun deleteItem(channelId: String, itemId: String): RainbowResult<Unit>

Delete an item (post) from a specific channel.

Link copied to clipboard
abstract suspend fun deleteUsersFromChannel(    channel: Channel,     contacts: ArrayList<IRainbowContact>): RainbowResult<Pair<List<ChannelUser>, List<String>>>
abstract suspend fun deleteUsersFromChannel(channel: Channel, contactsId: List<String>): RainbowResult<Pair<List<ChannelUser>, List<String>>>

Delete users from a channel by removing their affiliation.

Link copied to clipboard
abstract suspend fun fetchChannelItems(    channel: Channel,     limit: Int = 10,     beforeDate: Date?,     afterDate: Date?): RainbowResult<List<IChannelItem>>

Fetch items from a specific channel.

Link copied to clipboard
abstract suspend fun fetchChannelsByCategory(    category: String,     excludedCategories: List<String>? = null,     limit: Int = 100,     offset: Int = 0): RainbowResult<List<Channel>>

Fetch channels by specified categories.

Link copied to clipboard
abstract suspend fun fetchChannelsByDescription(topic: String): RainbowResult<List<Channel>>

Fetches channels by their description.

Link copied to clipboard
abstract suspend fun fetchChannelsByName(name: String): RainbowResult<List<Channel>>

Fetches channels by their name.

Link copied to clipboard
abstract suspend fun fetchLatestItems(limit: Int, beforeDate: Date?, afterDate: Date?): RainbowResult<List<IChannelItem>>

Fetch the latest items across all channels.

Link copied to clipboard
abstract suspend fun fetchMostFollowedChannels(limit: Int = 100, offset: Int = 0): RainbowResult<List<Channel>>

Fetch the most followed channels.

Link copied to clipboard
abstract suspend fun fetchMostRecentChannels(limit: Int = 100, offset: Int = 0): RainbowResult<List<Channel>>

Fetch the most recent channels.

Link copied to clipboard
abstract suspend fun fetchReactionsForChannelItem(    channel: Channel,     channelItem: IChannelItem,     reactionType: ReactionType? = null,     limit: Int = 50,     offset: Int = 0): RainbowResult<ChannelItemReactions>

Fetch reactions for a specific channel item.

Link copied to clipboard
abstract suspend fun fetchUsers(    channel: Channel,     limit: Int = 100,     offset: Int = 0,     userTypes: List<ChannelUserAffiliationType>? = null,     invitedUser: Boolean = false): RainbowResult<List<ChannelUser>>

Fetch users from a specific channel.

Link copied to clipboard
abstract suspend fun fetchUsersByName(channel: Channel, name: String, limit: Int = 20, offset: Int = 0): RainbowResult<List<ChannelUser>>

Fetch users matching a given name from a specific channel.

Link copied to clipboard
abstract fun getChannelById(channelId: String): Channel?

Retrieve a channel by its unique ID from local data.

Link copied to clipboard
abstract fun getChannelByName(channelName: String): Channel?

Retrieve a channel by its name from local data.

Link copied to clipboard
abstract fun markAllItemsAsRead(channel: Channel)

Mark all items (posts) in a channel as read.

Link copied to clipboard
abstract suspend fun muteChannel(channelId: String): RainbowResult<Unit>

Mute notifications for a specific channel.

Link copied to clipboard
abstract fun registerChangeListener(changeListener: IItemListChangeListener)

Register a listener to receive notifications about changes in the list of channels.

Link copied to clipboard

Registers a listener to receive notifications about channel events.

Link copied to clipboard
abstract suspend fun removeUserReactionForChannelItem(channel: Channel, item: IChannelItem): RainbowResult<IChannelItem>

Remove the user's reaction for a specific item in the channel.

Link copied to clipboard
abstract suspend fun searchChannels(    name: String? = null,     topic: String? = null,     categories: List<String>? = null,     excludedCategories: List<String>? = null,     subscribed: Boolean? = null,     limit: Int = 100,     offset: Int = 0,     sortField: String = "name",     sortOrder: Int = SORT_ASCENDING): RainbowResult<List<Channel>>

Search for channels based on various criteria.

Link copied to clipboard
abstract suspend fun subscribeToChannel(channel: Channel): RainbowResult<Channel>

Subscribe to a specific channel.

Link copied to clipboard
abstract suspend fun unmuteChannel(channelId: String): RainbowResult<Unit>

Unmute notifications for a specific channel.

Link copied to clipboard
abstract fun unregisterChangeListener(changeListener: IItemListChangeListener)

Unregister a listener to stop receiving notifications about changes in the list of channels.

Link copied to clipboard

Unregisters a previously registered listener to stop receiving notifications about channel events.

Link copied to clipboard
abstract suspend fun unsubscribeFromChannel(channel: Channel): RainbowResult<Unit>

Unsubscribe from a specific channel.

Link copied to clipboard
abstract suspend fun updateChannel(    channelId: String,     name: String? = null,     topic: String? = null,     mode: Channel.Mode? = null,     category: String? = null,     maxItems: Int? = null): RainbowResult<Channel>

Update a channel's details.

Link copied to clipboard
abstract suspend fun updateItem(channel: Channel, itemId: String, channelItem: IChannelItem): RainbowResult<String>

Update an existing item in the specified channel.

Link copied to clipboard
abstract suspend fun updateUserReactionForChannelItem(    channel: Channel,     item: IChannelItem,     reactionType: ReactionType): RainbowResult<IChannelItem>

Update the user's reaction for a specific item in the channel.

Link copied to clipboard
abstract suspend fun updateUsersToChannel(    channel: Channel,     type: ChannelUserAffiliationType,     contacts: ArrayList<IRainbowContact>): RainbowResult<Pair<List<ChannelUser>, List<String>>>
abstract suspend fun updateUsersToChannel(    channel: Channel,     type: ChannelUserAffiliationType,     contactsId: List<String>): RainbowResult<Pair<List<ChannelUser>, List<String>>>

Update users' affiliation in a channel.

Link copied to clipboard
abstract suspend fun uploadChannelAvatar(channelId: String, feedAvatar: File): RainbowResult<Unit>

Upload an avatar for a specific channel.